package org.abstractmeta.commandify.core.command;

import org.abstractmeta.commandify.Commandify;
import org.abstractmeta.commandify.OwnerSelfCommandifyAccessor;
import org.abstractmeta.reflectify.Accessor;

/**
 * Owner commandify
 */
public class OwnerSelfCommandifyAccessorImpl<O, T> implements OwnerSelfCommandifyAccessor<O, T> {

    private final Object source;
    private Commandify<O> commandify;
    private Accessor<O, T> accessor;

    public OwnerSelfCommandifyAccessorImpl(Object source, Commandify<O> commandify, Accessor<O, T> accessor) {
        if (accessor == null) {
            throw new IllegalArgumentException("accessor was null for " + source);
        }
        this.source = source;
        this.commandify = commandify;
        this.accessor = accessor;

    }


    @Override
    public Object getSource() {
        return source;
    }


    @Override
    public Accessor<O, T> getAccessor() {
        return accessor;
    }


    @Override
    public Commandify<O> getOwner() {
        return commandify;
    }

}
